Skip to main content

Animations

The viewer API implements a simple spring physics animation system. Besides setting values through the API, it is also possible to animate most values.

viewer.store.dispatch("frame/animate", {
from: 1,
to: 5,
});

The following values supports animation:

  • frame
  • zoom
  • zoomX
  • zoomY

You can use this to create some interesting effects like spinning the product around, zooming in on parts of the product (while animating frames).

animation cancelation

All the built in animations will by default be canceled if called from somewhere else, or if the user's input change the given value.

In the following example we listen to the viewer coming into view and then rotate it into view.